package controllers

import (
	"github.com/astaxie/beego"
	"html/template"
	"xianzhi/service"
)

// 推送时间相关
type PushTimeController struct {
	BaseController
}

func (c *PushTimeController) Index() {
	setMealId := c.GetString("id")
	if len(setMealId) <= 0 {
		c.Redirect(beego.URLFor("controllers.IndexController.Index"), 302)
		return
	}

	p := map[string]interface{}{}
	p["id"] = setMealId
	setMeal := service.GetSetMealInfo(p)
	if setMeal.Id <= 0 {
		c.Redirect(beego.URLFor("controllers.IndexController.Index"), 302)
		return
	}
	c.Data["setMealId"] = setMealId

	p = map[string]interface{}{}
	p["status"] = 1
	_, pushTimeList := service.GetPushTimeList(p)
	c.Data["pushTimeList"] = pushTimeList

	c.Data["xsrfdata"] = template.HTML(c.XSRFFormHTML())
	c.TplName = "push_time/index.html"
}
